package com.hxci.anbangyao.controller;

import com.hxci.anbangyao.dao.StudentabyDao;
import com.hxci.anbangyao.pojo.Studentaby;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("stu")
public class StudengtabyController {
    @Autowired
    StudentabyDao dao;

    @RequestMapping("query")
    public String query(Model model){
        List<Studentaby> list = dao.query();
        model.addAttribute("list",list);
        return "list";
    }

    @RequestMapping("add")
    public String add(){

        return "add";
    }

    @RequestMapping("save")
    public String save(Studentaby studentaby){
        int a = dao.save(studentaby);
        return "redirect: query";
    }

    @RequestMapping("del")
    public String del(Integer idaby){
        int a = dao.del(idaby);
        return "redirect: query";
    }

    @RequestMapping("index")
    public String index(){

        return "index";
    }



}
